//
//  YSGNurseAppointmentMapView.swift
//  EyeVisionForPatients
//
//  Created by liuyutian on 2022/3/3.
//  Copyright © 2022 QDSG. All rights reserved.
//

import UIKit




class YSGNurseAppointmentMapView: UIView, MAMapViewDelegate {
    
    
    
    override init(frame: CGRect) {
        super.init(frame: frame)
        makeUI()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        makeUI()
    }
  
    
    
    private func makeUI() {
        AMapServices.shared().enableHTTPS = true
        let mapView = MAMapView(frame: self.bounds)
        mapView.delegate = self
        mapView.showsUserLocation = true
        mapView.userTrackingMode = .follow
        mapView.setZoomLevel(15, animated: true)
        self.addSubview(mapView)
        
        let r = MAUserLocationRepresentation()
        r.showsAccuracyRing = true
        r.showsHeadingIndicator = true
        r.fillColor = UIColor.red
        r.strokeColor = UIColor.blue
        r.lineWidth = 2

        mapView.update(r)
        

    }
    
    //pragma mark - MAMapViewDelegate
    func mapViewRequireLocationAuth(_ locationManager: CLLocationManager!) {
        locationManager.requestAlwaysAuthorization()
    }
    
}


